import React, { Fragment } from 'react'
import NpyItem from '@/components/NpyItem'
import '@/pages/ToDoList/todolist.css'
import 'antd/dist/antd.css';
import { Input, List, } from 'antd'
const { Search } = Input;

export default (props) => {
      return (
      <Fragment>
        <div className="todo-bg">
          <Search
            id="todo"
            addonBefore="ToDoList："
            className="input"
            placeholder={props.placeholder}
            value={props.inputValue}
            onChange={props.inputChange.bind(this)}
            enterButton="增加"
            onSearch={() => { props.addValue() }}
          />
          <List
            size="small"
            bordered
            dataSource={props.newList}
            renderItem={(item, rowKey) =>
              <List.Item>
                <NpyItem
                  key={item.key}
                  ctn={item.val}
                  idx={rowKey}
                  deval={props.deValue.bind(this)}
                  editval={props.editValue.bind(this)}
                ></NpyItem>
              </List.Item>
            }
          />
        </div>
      </Fragment>
    )
}


